﻿using AEFunction;
using ESRI.ArcGIS.Carto;
using System;
using System.Windows.Forms;
namespace AETools.UI
{
    public partial class frmSelectRasterLayer : Form
    {
        public frmSelectRasterLayer()
        {
            InitializeComponent();
            
        }

        public ILayer[] Layers;

        public frmSelectRasterLayer(ILayer[] layers)
        {
            InitializeComponent();
            foreach (ILayer l in layers)
            {
                if (l is IRasterLayer)
                {
                    this.comboBoxYear96.Items.Add((object)l.Name);
                    this.comboBoxYear05.Items.Add((object)l.Name);
                    this.comboBox1.Items.Add((object)l.Name);
                }
                else
                {
                    this.comboBox2.Items.Add((object)l.Name);
                }
            }
            Layers = layers;
        }

        public frmSelectRasterLayer(string str1,string str2,ILayer[] layers)
    {
        InitializeComponent();
        foreach (ILayer l in layers)
        {
            if (l is IRasterLayer)
            {
                this.comboBoxYear96.Items.Add((object)l.Name);
                this.comboBoxYear05.Items.Add((object)l.Name);
                this.comboBox1.Items.Add((object)l.Name);
            }
            else
            {
                this.comboBox2.Items.Add((object)l.Name);
            }
        }
        Layers = layers;
            label3.Text=str1;
            label5.Text=str2;
    }

        /// <summary>
        /// 96年的栅格数据
        /// </summary>
        public IRasterLayer rasterLayer1996 = null;
        /// <summary>
        /// 05年的栅格数据
        /// </summary>
        public IRasterLayer rasterLayer2005 = null;

        public IRasterLayer forecastLayer = null;

        public IFeatureLayer pointLayer = null;

        private void buttonOk_Click(object sender, EventArgs e)
        {

            rasterLayer1996 = ArcEngineFunction.GetLayerByName(Layers, this.comboBoxYear96.SelectedItem.ToString()) as IRasterLayer;
            rasterLayer2005 = ArcEngineFunction.GetLayerByName(Layers, this.comboBoxYear05.SelectedItem.ToString()) as IRasterLayer;
            if (this.comboBox1.SelectedItem!=null)
                forecastLayer = ArcEngineFunction.GetLayerByName(Layers, this.comboBox1.SelectedItem.ToString()) as IRasterLayer;
            if (this.comboBox2.SelectedItem != null)
                pointLayer = ArcEngineFunction.GetLayerByName(Layers, this.comboBox2.SelectedItem.ToString()) as IFeatureLayer; 
        }

        private void buttonCancle_Click(object sender, EventArgs e)
        {

        }

        private void label5_Click(object sender, EventArgs e)
        {

        }

        private void label3_Click(object sender, EventArgs e)
        {

        }

        private void comboBoxYear05_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void comboBoxYear96_SelectedIndexChanged(object sender, EventArgs e)
        {

        }
    }
}